<div class="novocomentario row">
    <?php
    echo $this->Form->create('Comentarios.Comentario', array('url' => array('plugin' => 'comentarios', 'controller' => 'comentarios', 'action' => 'add')));
    echo $this->Form->input('Comentario.plugin', array('type' => 'hidden', 'value' => $this->request->params['plugin']));
    echo $this->Form->input('Comentario.controller', array('type' => 'hidden', 'value' => $this->request->params['controller']));
    echo $this->Form->input('Comentario.action', array('type' => 'hidden', 'value' => $this->request->params['action']));
    echo $this->Form->input('Comentario.id_registro', array('type' => 'hidden', 'value' => @$this->request->params['pass'][0]));
    echo $this->Form->input('Comentario.email', array('label' => FALSE, 'placeholder' => 'E-mail', 'type' => 'email', 'class' => 'form-control col-xs-12', 'div' => array('class' => 'col-xs-12', 'style' => 'margin: 2px 0px;')));
    echo $this->Form->input('Comentario.titulo', array('label' => FALSE, 'placeholder' => 'Nome', 'type' => 'text', 'class' => 'form-control col-xs-12', 'div' => array('class' => 'col-xs-12', 'style' => 'margin: 2px 0px;')));
    echo $this->Form->input('Comentario.descricao', array('label' => FALSE, 'placeholder' => 'Descrição', 'type' => 'textarea', 'class' => 'form-control col-xs-12', 'div' => array('class' => 'col-xs-12', 'style' => 'margin: 2px 0px;')));
    echo '<div class="col-xs-12 text-right">';
    echo $this->Form->button('Comentar', array('icon' => 'fa fa-comments-o', 'type' => 'submit', 'btn btn-sm btn-default'));
    echo '</div>';
    echo $this->Form->end();
    ?>
</div>
<?php
$div['class'] = (!isset($div['class']) ? '' : $div['class']);
$options = (!isset($options) ? array() : $options);

$_url = array('plugin' => 'comentarios', 'controller' => 'comentarios', 'action' => 'index');
$_named['named'] = array();
if (isset($this->request->params['plugin'])) {
    $_named['named']['Comentario.plugin'] = $this->request->params['plugin'];
}
if (isset($this->request->params['controller'])) {
    $_named['named']['Comentario.controller'] = $this->request->params['controller'];
}
if (isset($this->request->params['action'])) {
    $_named['named']['Comentario.action'] = $this->request->params['action'];
}
if (isset($this->request->params['pass'][0])) {
    $_named['named']['Comentario.id_registro'] = $this->request->params['pass'][0];
}
$_named['named']['Comentario.status'] = 1;
$_comentarios = $this->requestAction($_url, $_named);
?>

<div class="media">
    <?php
    if (count($_comentarios) > 0) {
        foreach ($_comentarios as $key => $value) {
            ?>
            <div class="row">
                <div class="col-xs-12">
                    <a style="border: 0px solid red; margin-right: 8px;" class="pull-left" href="#">
                        <?php echo $this->Gravatar->displayProfilePicture('', $value['Comentario']['email']); ?>
                    </a>
                    <div class="media-body">
                        <h4 class="media-heading"> <?php echo $value['Comentario']['titulo']; ?></h4>
                        <p> <?php echo nl2br($value['Comentario']['descricao']); ?></p>

                    </div>
                </div>
            </div>
            <hr>
            <?php
        }
    }
    ?>

</div>

